function out = gfilter(data, el, type)
% out = gfilter(data, el, 'type')
% implemented types:
%   'avg'
%   'median'

% convert to single-row format if necessary
flag = 0;
[row, col] = size(data);
if col == 1
    data = data';
    flag = 1;
end

% call filter
filtered = colfilt(data, [1 el], 'sliding', 'mean');
% 
% switch type
% case 'mean'
% case 'median'
% 	filtered = colfilt(data, [1 el], 'sliding', 'median');
% end

% reconvert to column format if necessary
if flag
    filtered = filtered';
end

% output
out = filtered;